package iscript.gameFramework.IsoEngine.display 
{
	import iscript.uiFramework.baseShape.Ball;
	//import iscript.uiFramework.baseShape.Diamond;

	/**
	 * 为了开发方便,把注册点设置在左上角.
	 * 正方形 转换成 菱形 ◇
	 * 100*100  =>  142*71
	   width *1.42
	   height * 0.71
	   return Math.round(height * 0.71);
	   
	   h    1
	   -  = -
	   w    2
	 */
	
	 
	public class IsoTileGrid extends IsoObject
	{
		private var _color:Boolean;
		public function IsoTileGrid(size:Number=0,color:Boolean=false)
		{
			_color = color;
			super(size);
			draw();
		}
			
		override protected function draw():void 
		{
			super.draw();
			bottomGrid();
		}
		
		public function  bottomGrid():void {
			graphics.clear();
			if(_color)graphics.beginFill(Math.random()*0xFFFFFF);
			graphics.lineStyle(1, 0x000000, 1);
			graphics.moveTo(0,-_size>>1);    			 //Top    Point
			graphics.lineTo(_size,0);     				 //Right  Point
			graphics.lineTo(0, _size>>1);    		     //Bottom Point
			graphics.lineTo( -_size, 0);    		     	 //Left   Point
			graphics.lineTo(0,-_size>>1)
			graphics.endFill();	
			/*this.graphics.clear();
			  this.graphics.beginFill(0xFFFFFF);
			  this.graphics.lineStyle(1, 0x000000, 1);
			  this.graphics.moveTo(_size, 0);    				 //Top    Point
			  this.graphics.lineTo(_size << 1, _size >> 1);      //Right  Point
			  this.graphics.lineTo(_size, _size);    		     //Bottom Point
			  this.graphics.lineTo(0, _size >> 1);    		     //Left   Point
			  this.graphics.endFill();*/
		}
		
		
		public function setColor(_color:uint):void {
				graphics.clear();
				graphics.beginFill(_color);
				graphics.lineStyle(1, 0x000000, 1);
				graphics.moveTo(0,-_size>>1);    			 //Top    Point
				graphics.lineTo(_size,0);     				 //Right  Point
				graphics.lineTo(0, _size>>1);    		     //Bottom Point
				graphics.lineTo(-_size,0);    		     	 //Left   Point
				graphics.endFill();	
			}
		
		 
	    public function ball():void {
			   var bball:Ball = new Ball(5)
				addChild(bball)
			}
		
		
	}

}